package com.chexiehui.jc.entity;

import com.blankj.utilcode.util.StringUtils;
import com.blankj.utilcode.util.TimeUtils;
import com.chexiehui.jc.widget.indexbar.suspension.ISuspensionInterface;

import java.io.Serializable;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * 车系
 */
public class CarSeriesInfo implements ISuspensionInterface, Serializable {
    private String Id;// (string, optional): 车系id ,
    private String Name;// (string, optional): 车系名称 ,
    private String Img;// (string, optional): 车系图片 ,
    private List<String> Imgs;// (string, optional): 车系图片 ,
    private String PriceMin;// (string, optional): 最低价 ,
    private String PriceMax;// (string, optional): 最高价 ,
    private String Price;// (string, optional): 价格 ,
    private String CreateTime;// (string, optional): 关注时间

    private String ForumId;

    private String[] SizeType;
    private String FactoryName;
    private String NewDealPrice;
    private String IsPreferential;
    private List<String> SaleYearList;
    private List<CarBriefliesInfo> CarBrieflies;
    private boolean isAddCarFollow;

    private String Energy;
    private String Hot;
    private int Salesvolume;
    private boolean IsFollow;

    private String typeName;

    public CarSeriesInfo() {
    }

    public CarSeriesInfo(boolean isAddCarFollow) {
        this.isAddCarFollow = isAddCarFollow;
    }

    public String getForumId() {
        return ForumId == null ? "" : ForumId;
    }

    public void setForumId(String forumId) {
        ForumId = forumId;
    }

    public String getId() {
        return Id == null ? "" : Id;
    }

    public void setId(String id) {
        Id = id;
    }

    public String getName() {
        return Name == null ? "" : Name;
    }

    public void setName(String name) {
        Name = name;
    }

    public List<String> getImgs() {
        return Imgs == null ? Imgs = new ArrayList<>() : Imgs;
    }

    public void setImgs(List<String> imgs) {
        Imgs = imgs;
    }

    public String getImg() {
        return Img == null ? "" : Img;
    }

    public void setImg(String img) {
        Img = img;
    }

    public String getPriceMin() {
        return PriceMin == null ? "" : PriceMin;
    }

    public void setPriceMin(String priceMin) {
        PriceMin = priceMin;
    }

    public String getPriceMax() {
        return PriceMax == null ? "" : PriceMax;
    }

    public void setPriceMax(String priceMax) {
        PriceMax = priceMax;
    }

    public String getPrice() {
        return Price == null ? "" : Price;
    }

    public void setPrice(String price) {
        Price = price;
    }

    public String getPriceMaxMinStr() {
        if (getPriceMin().equals("") && getPriceMax().equals("")) {
            return "";
        } else if (getPriceMin().equals("")) {
            return getPriceMax() + "万";
        } else if (getPriceMax().equals("")) {
            return getPriceMin() + "万";
        } else {
            return getPriceMin() + "-" + getPriceMax() + "万";
        }
    }

    public String getPriceQi() {
        if (!getPriceMin().equals("")) {
            return getPriceMin() + "万起";
        } else if (!getPrice().equals("")) {
            return getPrice() + "万起";
        } else {
            return "暂无报价";
        }
    }

    public String getGuidancePriceMaxMinStr() {
        if (getPriceMin().equals("") && getPriceMax().equals("")) {
            return "指导价：暂无报价";
        } else if (getPriceMin().equals("")) {
            return "指导价：" + getPriceMax() + "万";
        } else if (getPriceMax().equals("")) {
            return "指导价：" + getPriceMin() + "万";
        } else {
            return "指导价：" + getPriceMin() + "-" + getPriceMax() + "万";
        }
    }

    public String getCreateTime() {
        return CreateTime == null ? "" : CreateTime;
    }

    public String getShangShiTime() {
        if(StringUtils.isTrimEmpty(CreateTime)){
            return "";
        }
        Date d= TimeUtils.string2Date(CreateTime);
        if(d == null){
            return "";
        }
        return TimeUtils.date2String(d, new SimpleDateFormat("MM月dd日上市"));
    }

    public void setCreateTime(String createTime) {
        CreateTime = createTime;
    }

    public String[] getSizeType() {
        return SizeType;
    }

    public void setSizeType(String[] sizeType) {
        SizeType = sizeType;
    }

    public String getSizeTypeStr() {
        if (SizeType == null) {
            return "";
        }
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < SizeType.length; i++) {
            if (i == SizeType.length - 1) {
                sb.append(SizeType[i]);
            } else {
                sb.append(SizeType[i])
                        .append("/");
            }
        }
        return sb.toString();
    }

    public String getFactoryName() {
        return FactoryName == null ? "" : FactoryName;
    }

    public void setFactoryName(String factoryName) {
        FactoryName = factoryName;
    }

    public String getNewDealPrice() {
        return NewDealPrice == null ? "" : NewDealPrice;
    }

    public void setNewDealPrice(String newDealPrice) {
        NewDealPrice = newDealPrice;
    }

    public String getIsPreferential() {
        return IsPreferential == null ? "" : IsPreferential;
    }

    public void setIsPreferential(String isPreferential) {
        IsPreferential = isPreferential;
    }

    public List<CarBriefliesInfo> getCarBrieflies() {
        return CarBrieflies == null ? CarBrieflies = new ArrayList<>() : CarBrieflies;
    }

    public void setCarBrieflies(List<CarBriefliesInfo> carBrieflies) {
        CarBrieflies = carBrieflies;
    }

    public boolean isAddCarFollow() {
        return isAddCarFollow;
    }

    public void setAddCarFollow(boolean addCarFollow) {
        isAddCarFollow = addCarFollow;
    }

    public String getEnergy() {
        return Energy;
    }

    public void setEnergy(String energy) {
        Energy = energy;
    }

    public String getHot() {
        return Hot;
    }

    public String getHotStr() {
        return Hot == null ? "" : Hot;
    }

    public void setHot(String hot) {
        Hot = hot;
    }

    public int getSalesvolume() {
        return Salesvolume;
    }

    public void setSalesvolume(int salesvolume) {
        Salesvolume = salesvolume;
    }

    public boolean isFollow() {
        return IsFollow;
    }

    public void setFollow(boolean follow) {
        IsFollow = follow;
    }

    public String getTypeName() {
        return typeName == null ? "" : typeName;
    }

    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }

    @Override
    public boolean isShowSuspension() {
        return true;
    }

    @Override
    public String getSuspensionTag() {
        return getTypeName();
    }

    public List<String> getSaleYearList() {
        return SaleYearList;
    }

    public void setSaleYearList(List<String> saleYearList) {
        SaleYearList = saleYearList;
    }
}
